using FineCollection.Cont;
using FineCollection.Intf;
using FineCollection.Utils;

using NUnit.Framework;




namespace FineCollection.Utils
{
    [TestFixture]
    public class BasingRandomListView_test
    {


        private class BaseClass
        {
            internal long var1;
            public BaseClass(long var1) { this.var1 = var1;}
        }

        private class ConcreteClass1 : BaseClass
        {
            internal long var2;
            public ConcreteClass1(long var1, long var2) : base(var1) { this.var2 = var2; }
        }



        [Test]
        public void Test_Basic_Classes_1()
        {
            WRandomList<ConcreteClass1> crlist = new ArrList<ConcreteClass1>(91, 3);
            crlist.Add(new ConcreteClass1(1001,2001));
            crlist.Add(new ConcreteClass1(1002,2002));
            crlist.Add(new ConcreteClass1(1003,2003));

            RRandomList<BaseClass> bview =
                new BasingRandomListView<BaseClass,ConcreteClass1>(crlist);

            Assert.AreEqual(crlist.Count,      bview.Count);
            Assert.AreEqual(crlist.FirstIndex, bview.FirstIndex);
            Assert.AreEqual(crlist.LastIndex,  bview.LastIndex);

            Assert.AreSame(crlist.First, bview.First);
            Assert.AreSame(crlist.Last, bview.Last);
        }

    }
}